<template>
    <div class="screen-wrap" ref="screen">
        <iframe width="100%" height="100%" src="https://xz.tengcity.com/screen" frameborder="0"></iframe>

        <i class="full-icon" :class="!isFullFlag ? 'full' : 'reduce'" @click="handleFull"></i>

    </div>
  </template>

  <script>
    import screenfull from 'screenfull'

    export default {
        data(){
            return {
                isFullFlag: false
            }
        },
        computed: {
            url(){
                return SCREEN_URL
            }
        },
        mounted(){
            screenfull.on('change', () => {
                this.isFullFlag = screenfull.isFullscreen
            })
        },
        methods: {
            handleFull(){
                screenfull.toggle(this.$refs.screen)
            }
        }
    }
  </script>

  <style lang="less" scoped>
    .screen-wrap{
        width: 100%;
        height: 100vh;
        position: relative;

        .full-icon{
            position: absolute;
            width: 32px;
            height: 32px;
            top: 10px;
            right: 20px;
            z-index: 999;
            color: #fff;
            font-size: 30px;
            cursor: pointer;

            &.full{
                background: url('../../assets/full-screen.png') center no-repeat;
            }

            &.reduce{
                background: url('../../assets/reduce-screen.png') center no-repeat;
            }
        }
    }
  </style>